<!DOCTYPE html>
<html lang="zh-CN" >
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
	<title>想即做thinkTodo任务清单</title>

<link rel="shortcut icon" href="/favicon.ico"/>
<link rel="bookmark" href="/favicon.ico"/>
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">

<link href="/libs/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/_assets/css/fonts.css">


<!--
本地 Bootstrap 核心 CSS 文件
本地jQuery文件。务必在bootstrap.min.js 之前引入
本地 Bootstrap 核心 JavaScript 文件 
-->
    
<link rel="stylesheet" href="/libs/bootstrap-3.3.5-dist/css/bootstrap.min.css">
<script src="/libs/jquery/jquery-1.11.3.min.js"></script>
<script src="/libs/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>


 <!--
 <link rel="stylesheet" href="/libs/jquery-ui/themes/base/jquery.ui.all.css">     
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
-->      
    <!-- Add IntroJs styles -->
    <link href="/libs/introjs/introjs.css" rel="stylesheet"> 
      

<link rel="stylesheet" href="/_assets/css/base.css" >
<link rel="stylesheet" href="/_assets/css/home_with_bs.css" >
<link rel="stylesheet" href="/_assets/css/task_with_bs.css" >
<link rel="stylesheet" href="/_assets/css/style_tags.css" >
<style>
 
</style>
      
<link href='/libs/fullcalendar-1.6.1/fullcalendar/fullcalendar.css' rel='stylesheet' />
<link href='/libs/fullcalendar-1.6.1/fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' />

<script src='/libs/fullcalendar-1.6.1/jquery/jquery-1.9.1.min.js'></script>
<script src="/libs/layer/layer.js"></script>	


 <script type="text/javascript"> 
	var workarea='';
	var node_type_icon = new Object();
	node_type_icon["S"] ="fa-search";
	node_type_icon["undefined"] ="";
	domain="www.thinktodo.cn";
	
	var stage_svg_icon = {
		'':'/_assets/icons/blank.svg',
		'think':'/_assets/icons/add.svg',
		'undefined':'/_assets/icons/add.svg',
		'null':'/_assets/icons/add.svg',
		'doing':'/_assets/icons/play-circle.svg',
		'urgent':'/_assets/icons/bomb.svg',
		'farm-out':'/_assets/icons/paper-plane.svg',
		'suspend':'/_assets/icons/pause-circle.svg',
		'finish':'/_assets/icons/add.svg',
		'saved':'/_assets/icons/add.svg'
	};
	
	var stage_icon = {
		'think':'fa-lightbulb-o',
		'undefined':'',
		'null':'',
		'doing':'fa-play',
		'urgent':'fa-bomb',
		'farm-out':'fa-send',
		'suspend':'fa-pause',
		'finish':'fa-flag',
		'saved':'fa-hdd'
	};
	
	var drag_type="task";
	var calendar_show=true;
	var current_edit_taskid;
	var current_opt_task_id;
	var current_opt_dom_id;
	var unique_dom_id=1000;//用于生成唯一dom id的起始序号
	var anchor_taskid;
	


	
function append_child_task_by_jquery(selector,item){
	$(selector).append(new_task(item));
	$(selector).children("a.expend_fold").children("i").css("color",'red');
}
	
function ifNullToString(obj){
	if(obj==null){
		return '';
	}else{
		return obj.toString();
	}
}	
 function redraw(id){
	$("div.task[data-taskid="+id+"]"+" div.task").empty();
	expend_child(id);
 }
function refresh_one_node(id){
		$.getJSON("/index.php/task/get/"+id, 
			function(dataGet) { 
//				console.log(dataGet);
				if(dataGet){					
					$.each(dataGet,function(idx,item){ 
//						console.log(item);
						$("div.task[data-taskid="+id+"]"+" .task_header").html(new_task_header(item));
					}); 
				}
			}
		);
	hide_toolbar();
	expend_child(id);
//	drag_task_for_calendar();
} 
 
function refresh_child(id){
	if(!id){
		id=current_opt_task_id;
	}
		$.getJSON("/index.php/task/getnode/"+id, 
			function(dataGet) { 
				if(dataGet){
					$("div.task[data-taskid="+id+"] div.task").remove();
					$.each(dataGet,function(idx,item){ 
					
						//$(".task[data-taskid="+id+"]").append(new_task(item));
						//$(".task[data-taskid="+id+"]").children("a.expend_fold").children("i").css("color",'red');
						append_child_task_by_jquery(".task[data-taskid="+id+"]",item);
						
//						alert(item.id);
					}); 
				}
			}
		);
	hide_toolbar();
	expend_child(id);
//	drag_task_for_calendar();
}

function refresh_dom_child(domid){
	if(!domid){
		domid=current_opt_dom_id;
	}
	var taskid=$('#'+current_opt_dom_id).attr("data-taskid");
//	console.log(domid);
//	console.log(taskid);
		$.getJSON("/index.php/task/getnode/"+taskid, 
			function(dataGet) { 
				if(dataGet){
					$("#"+domid+" div").remove();
					$.each(dataGet,function(idx,item){ 
						//$("#"+domid).append(new_task(item));
						//$("#"+domid).children("a.expend_fold").children("i").css("color",'red');
						append_child_task_by_jquery("#"+domid,item);
//						alert(item.id);
					}); 
				}
			}
		);
	hide_toolbar();
	expend_child(taskid);
//	drag_task_for_calendar();
}

function refresh_child_recursion(idArray,sys){
	var action;
	if(sys==1){
		action='getnode_sys';
	}else{
		action='getnode';
	}
//	console.log(idArray);
	var id=idArray.shift();
//	console.log(id);
	if(id==undefined){
		return;
	}
	
	$("div.task[data-taskid="+id+"] div.task").remove();
		$.getJSON("/index.php/task/"+action+"/"+id, 
			function(dataGet,status) {
//				console.log(dataGet);
//				console.log(status);
				if(dataGet){
					$.each(dataGet,function(idx,item){ 
						//$(".task[data-taskid="+id+"]").append(new_task(item));
						//$(".task[data-taskid="+id+"]").children("a.expend_fold").children("i").css("color",'red');
						append_child_task_by_jquery(".task[data-taskid="+id+"]",item);
					}); 
//					idArray.shift();
					expend_child(id);
				}
				if(idArray.length>0){						
						refresh_child_recursion(idArray,sys);
				}else{
						return;
				}
			}
		);
//	hide_toolbar();

//	drag_task_for_calendar();
}

function tasks_refresh_child(idArray){
	var i = idArray.length;
	var id;
	while (i--) {
		id=idArray[i];
//		console.log(id);
		$("div.task[data-taskid="+id+"]"+" div.task").remove();
		$.getJSON("/index.php/task/getnode/"+id, 
			function(dataGet) { 
				if(dataGet){
					$.each(dataGet,function(idx,item){ 
//						$(".task[data-taskid="+id+"]").append(new_task(item));
						append_child_task_by_jquery(".task[data-taskid="+id+"]",item);
					}); 
					expend_child(id);
				}
				
			}
		);
	}
	return;
}
function expend_all_actived_task(){
		$.getJSON("/index.php/task/search_by_stage/doing", 
			function(dataGet) { 
				if(dataGet){
//					$("#"+domid+" div").remove();
//					$(event.target).parents("div.title_task").remove;
					$.each(dataGet,function(idx,item){ 
						append_to_root(item.id,false);
//						$("#"+domid).append(new_task(item));
//						alert(item.id);
					}); 
				}
//				$("#"+domid+">a>i.fa-folder-o").addClass('fa-folder-open-o');
//				$("#"+domid+">a>i.fa-folder-o").removeClass('fa-folder-o');
			}
		);

}
function position_task_id(id){
	if(!id){
		id=current_opt_task_id;
	}
	element = $("#simple_view .task[data-taskid="+id+"]");
	if(element.length>0){
		$("#simple_view .task[data-taskid="+id+"]").children("span.task_title").addClass('twink');
		$("#simple_view .task[data-taskid="+id+"]").show();
		$("#simple_view .task[data-taskid="+id+"]").parents("div.task").show();
		$("#simple_view").show();
		$.scrollTo($('div.task[data-taskid="'+id+'"]'),500,{ offset:{ top:-50, left:0 }}); 
	}else{
		element = $("#alltask_view .task[data-taskid="+id+"]");
		if(element.length>0){
			$("#alltask_view .task[data-taskid="+id+"]").children("span.task_title").addClass('twink');
			$("#alltask_view .task[data-taskid="+id+"]").show();
			$("#alltask_view .task[data-taskid="+id+"]").parents("div.task").show();
			$("#alltask_view").show();
			$.scrollTo($('div.task[data-taskid="'+id+'"]'),500,{ offset:{ top:-50, left:0 }}); 
		}else{
			append_to_root(id,true);
		}
	}
	
//	$("#alltask_view .task[data-taskid="+id+"]").children("span.task_title").addClass('twink');	
	hide_toolbar();	
}
function append_to_root(id,twink){
	
	if(!id){
		id=current_opt_task_id;
	}
	if(twink==undefined){
		twink=true;
	}
//	console.log(id);
		var parentid;
		var element;
		$.getJSON("/index.php/task/getparents/"+id, 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){
//					$("div.task[data-taskid="+id+"]"+" div").remove();
					parentid=0;
					$.each(dataGet.data,function(idx,item){ 
						element = $(".task[data-taskid="+parentid+"]"+' '+".task[data-taskid="+item.id+"]");
						if(element.length>0){
							
						}else{
//							$(".task[data-taskid="+parentid+"]").append(new_task(item));
							append_child_task_by_jquery(".task[data-taskid="+parentid+"]",item);
							
							
						}
//如果在分类视图下，显示分类视图						
						if(parentid==1){													
						$("#alltask_view").show(500);
						$("#alltask_container").attr("data-visible",'show');	
						}						
						//如果在分类视图下，显示分类视图						
						if(parentid==2||parentid==3){													
						$("#simple_view").show(500);
						$("#simple_container").attr("data-visible",'show');	
						}
						
//展开这些节点，本应该用展开函数的						
						$(".task[data-taskid="+parentid+"]").show();
						$(".task[data-taskid="+item.id+"]").show();
						parentid=item.id;
//						console.log($("#task"+item.id));


					});



				}
			if(twink){
				$("#simple_view .task[data-taskid="+id+"]").children("span.task_title").addClass('twink');
				$("#alltask_view .task[data-taskid="+id+"]").children("span.task_title").addClass('twink');
				$.scrollTo($('div.task[data-taskid="'+id+'"]'),500); 
			}else{
				
			}
			}
		);
}

function append_to_parent(id){
	if(!id){
		id=current_opt_task_id;
	}
//	console.log(id);
		var parentid;
		var element;
		$.getJSON("/index.php/task/getparents/"+id, 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){
//					$("div.task[data-taskid="+id+"]"+" div").remove();
					parentid=0;
					$.each(dataGet.data,function(idx,item){ 
						element = $(".task[data-taskid="+parentid+"]"+' '+".task[data-taskid="+item.id+"]");
						if(element.length>0){
							
						}else{
//							$(".task[data-taskid="+parentid+"]").append(new_task(item));
							append_child_task_by_jquery(".task[data-taskid="+parentid+"]",item);
						}
						parentid=item.id;
//						console.log($("#task"+item.id));
					}); 
				}
			$("#alltask_view .task[data-taskid="+id+"]").children("span.task_title").addClass('twink');	
			}
		);
	hide_toolbar();	
//	console.log(id);
//	console.log($(".task[data-taskid="+id+"]"));
//	console.log($(".task[data-taskid="+id+"]").children('span.task_title'));
//	expend_child(id);
}

function create_help_view(){
		var items;
		$.getJSON("/index.php/task/gethelp/", 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){
//					console.log(dataGet.data);
					items=dataGet.data;
						$.each(items,function(idx,item){ //生成所有任务，先挂装到不分类任务下
                            $("#help_view .task[data-taskid=231]").append(new_task(item));
						});
						$("#help_view .task[data-taskid=231] div.task").hide();
                        $.each(items,function(idx,item){ //所有任务依据自己的parnet挂装
							$("#help_view .task[data-taskid="+item.parent+"]").append($("#help_view .task[data-taskid="+item.id+"]"));
						});	
//							
//					$('#btn_refresh_all i').removeClass('fa-spin');
					expend_icon_status();
					$(".task[data-taskid=231]>div.task").show();
				}
			}		
		);
		$('#btn_refresh_all i').addClass('fa-spin');  
}

function refresh_all_and_append(){
		
		var loading=layer.msg('正从服务器上加载数据，请稍候！', {icon: 16});
//		var loading = layer.load(2); //换了种风格

//
		var items;
		$.getJSON("/index.php/task/getall/"+Math.ceil(Math.random()*100), 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){
//					console.log(dataGet.data);
					console.time('生成任务DOM开始');
					items=dataGet.data;
						var frag = document.createDocumentFragment();
						$.each(items,function(idx,item){ //生成所有任务，先放到任务挂装区
	//						console.log(item);//每个约5ms左右
//                            $("#904").append(new_task(item));//用在frag中挂装，而后一次性挂装到DOM，提高性能
							$(frag).append(new_task(item));
						});
						$("#904").append($(frag));//
					console.timeEnd('生成任务DOM结束');
						$("#904>div.task").hide();
                        $.each(items,function(idx,item){ //所有任务依据自己的parnet挂装
//							console.log(item);//每个需15ms左右
							$("#simple_view .task[data-taskid="+item.parent+"]").append($("#simple_view .task[data-taskid="+item.id+"]"));
							$("#alltask_view .task[data-taskid="+item.parent+"]").append($("#simple_view .task[data-taskid="+item.id+"]"));						
//							$(".task[data-taskid="+item.parent+"]").append($("#simple_view .task[data-taskid="+item.id+"]"));
						});	
//							
					$('#btn_refresh_all i').removeClass('fa-spin');
					expend_icon_status();
					$("#901>div.task").show();
					$("#902>div.task").show();
					
					//关闭
//					layer.close(index); 
					layer.close(loading); 
				}
			}		
		);
		$('#btn_refresh_all i').addClass('fa-spin');  
}		

function refresh_all_and_append1(){

		var parent;
		var element;
		var noappenditems=new Array;
		var items;
		var i=0;
		$.getJSON("/index.php/task/getall/", 
			function(get_result) { 
//			console.log(dataGet);
				if(get_result.data){
//					$("div.task[data-taskid="+id+"]"+" div").remove();
//					parentid=0;
//					console.log(dataGet.data);
					items=get_result.data;
					//console.log(items);
					while(items.length>0){
						i++;
						$.each(items,function(idx,item){ //对每一项任务
//							console.log(item);
							element = $(".task[data-taskid="+item.parent+"]"+' '+".task[data-taskid="+item.id+"]");
							parent = $(".task[data-taskid="+item.parent+"]");
							if(element.length>0){//如果已存在该任务
	//							items.splice(idx,1);
							}else{
								if(parent.length>0){//如果已存在父任务
									$(".task[data-taskid="+item.parent+"]").append(new_task(item));
									$(".task[data-taskid="+item.id+"]").css('display','none');
	//								items.splice(idx,1);
								}else{//如果没有父任务，则存到未挂装中
	//								console.log(item);
	//								console.log(idx);
									noappenditems.push(item);
								}
								
							}
							
							
						}); 
//						console.log(noappenditems);
						if(items.length==noappenditems.length||i>2){
							break;
						}
						items=noappenditems;//把未挂装的任务调出重做
						noappenditems=Array(0);
						
					}
					
					$('#btn_refresh_all i').removeClass('fa-spin');
					expend_icon_status();
				}else{
					console.log(get_result);
				}
			}		
		);
		$('#btn_refresh_all i').addClass('fa-spin');



}
function refresh_update_task(){


	//如果有该任务
	//如果父任务下有该任务，不操作
	//如果该任务没有挂装在父任务下，移动其位置
	//如果没有该任务，则生成一个任务，并挂装到父节点下
	
	//改变任务内容
	
	//var loading=layer.msg('正从服务器上加载数据，请稍候！', {icon: 16});
		var loading = layer.load(2); //换了种风格

		var items;
		$.getJSON("/index.php/task/getlastedit/", 
			function(get_result) { 
//			console.log(dataGet);
				if(get_result.data){
//					console.log(dataGet.data);
					items=get_result.data;
						$.each(items,function(idx,item){ //生成所有任务，先挂装到不分类任务下
							element = $(".task[data-taskid="+item.id+"]");
							parent_element = $(".task[data-taskid="+item.parent+"]"+' '+".task[data-taskid="+item.id+"]");
							parent = $(".task[data-taskid="+item.parent+"]");
							if(parent_element.length>0){//如果已存在该任务,且父子对象位置正确
	//							items.splice(idx,1);
							}else{
								if(parent.length>0){//如果已存在父任务
									if(element.length>0){//且子对象也存在
										$(".task[data-taskid="+item.parent+"]").append(element);
									}else{
										$(".task[data-taskid="+item.parent+"]").append(new_task(item));
										$(".task[data-taskid="+item.id+"]").css('display','none');
									}
								}else{//如果没有父任务，则存到未挂装中
	//								console.log(item);
	//								console.log(idx);
									noappenditems.push(item);
								}
								
							}
							
							
							
                            $(".task[data-taskid=3]").append(new_task(item));
						});
						$(".task[data-taskid=3]>div.task").hide();
                        $.each(items,function(idx,item){ //所有任务依据自己的parnet挂装
//							console.log(item);
							$("#simple_view .task[data-taskid="+item.parent+"]").append($("#simple_view .task[data-taskid="+item.id+"]"));
							$("#alltask_view .task[data-taskid="+item.parent+"]").append($("#simple_view .task[data-taskid="+item.id+"]"));
						});	
//							
					$('#btn_refresh_all i').removeClass('fa-spin');
					expend_icon_status();
					$(".task[data-taskid=1]>div.task").show();
					$(".task[data-taskid=2]>div.task").show();
					
					//关闭
//					layer.close(index); 
					layer.close(loading); 
				}
			}		
		);
		$('#btn_refresh_all i').addClass('fa-spin');  
	
	
}

function create_root_task(){
	var item = new Object;
	item.id = 1;
	item.title = '所有任务';
	item.sort=100;
	item.getway="R";
	$("div#alltask_view div").remove();
	$("#alltask_view").append(new_task(item));
}

function create_one_task_from_db(id,dom_id){
	var htmlstr;
		$.getJSON("/index.php/task/get/"+id, 
			function(dataGet) { 
//				console.log(dataGet);
				if(dataGet){
					htmlstr=new_task(dataGet);					
//					console.log(htmlstr);
						var timestamp = (new Date()).valueOf(); 
//						console.log('1-'+timestamp);
						$(dom_id).append(htmlstr);
//					return htmlstr;//注意要放在这里，否则你可能等不到返回信息
					}
			}
		);

//	console.log(htmlstr);
	var timestamp = (new Date()).valueOf(); 
//	console.log('2-'+timestamp);
	return ;
}

function create_one_task(item,container_dom){
	$(container_dom).append(new_task(item));
	return new_task(item);
}

 function create_title_task(item,container_dom){
//	 console.log(container_dom);
	var new_dom_id = unique_dom_id++;
	var htmlstr='<div  id="'+new_dom_id+'" ';
	htmlstr+=' class="task title_task" data-stage="'+item.stage+'">'
	+'<a class="icon_button expend_fold" href="###"   title="展开"><i  class="fa fa-folder-o"></i></a>'
	+'<span class="task_title">'+item.title+'</span>'
	+'<a class="stage_icon"></a>'
//	+'<span class="task_stage"><i  class="fa '+stage_icon[item.stage]+'"></i></span>'
	+'<a><i  class="fa fa-refresh" onclick="search_by_stage()"></i></a>'
	+'</div>';
//	console.log(htmlstr);
	$(container_dom).append(htmlstr);
 }

 

 function fold_child(id){
	re_draw(id);
 }
 

 
 
 
 
 function simple_task_add(){

 	var new_task_title=$("#input_simple_task_add").val();
	if (new_task_title==''){
//		Huimodal_alert('空内容，无视！','2000');
		layer.msg('空内容，无视！',{time: 2000});
		return;
	}
//	alert(new_task_title);
	$.post("/index.php/task/insert",
	  {
		title:new_task_title,
		parent:2
	  },
	  function(dataGet,status){
		if(dataGet){
			
				$("#input_simple_task_add").val('');
					var item = new Object;
					item.id = dataGet.data.newid;
					item.title = new_task_title;
					item.sort=dataGet.data.newnode_sort;
                    $(new_task(item)).insertAfter(".task[data-taskid=2]>a.btn_for_toolbar");
					
			if(dataGet.status){
			}else{
//				Huimodal_alert(,'2000');
				layer.msg(dataGet.message,{time: 2000});
			}
		}
	  },"json");
 }
 
 
 function tags_split_html(tagstr){
	
	tagstr = tagstr.replace(/,|:|，|　/g, ' ');
//	console.log(tagstr);
	tagstr = tagstr.replace(/\s+/g,' ');
//	console.log(tagstr);
 	var tags= new Array(); //定义一数组
	tags=tagstr.split(" "); //字符分割 
	var tag_html='';	
	for (i=0;i<tags.length ;i++ )  {
		tag_html+='<b>&nbsp;'+tags[i]+'&nbsp;</b> ';
	}
//	console.log(tag_html);
	return tag_html;
 }
 
  function style_tags_split_html(tagstr){
	
	tagstr = tagstr.replace(/,|:|，|　/g, ' ');
//	console.log(tagstr);
	tagstr = tagstr.replace(/\s+/g,' ');
//	console.log(tagstr);
 	var tags= new Array(); //定义一数组
	tags=tagstr.split(" "); //字符分割 
	var style_html='';	
	for (i=0;i<tags.length ;i++ )  {
		if(tags[i].substr(0,3)=='fa-'){
			style_html+='<i class="fa '+tags[i]+'"></i> ';
		}
	}
//	console.log(tag_html);
	return style_html;
 }
 

 function new_task(item){
//	console.log(item);
//	var new_dom_id = (new Date()).valueOf()+Math.round((Math.random()*1000)); 
	var new_dom_id = unique_dom_id++;
//	console.log(new_dom_id);
	var htmlstr='<div  data-taskid="'+item.id+'" ';
	if(item.getway=='S'){
		htmlstr+=' class="task getby_search " id="'+new_dom_id+'"';
		
	}else{
		htmlstr+=' class="task getby_parent " id="'+new_dom_id+'"'
		+' draggable="true" ondragstart="task_dragstart(event)" ';//仅有正常节点才能被拖放
	}
	htmlstr=htmlstr
	+' data-sort="'+item.sort+'"'
	+' data-stage="'+item.stage+'"'
	+' data-archive="'+item.archive+'"'
	+' data-getway="'+item.getway+'"'
	+' data-intags="'+item.intags+'"'
	+' data-tags="'+item.tags+'"';
	if(!item.nodetype){
		htmlstr+=' ondragover="task_dragover(event)" ondrop="task_drop(event)" ondragenter="task_dragenter(event)" ondragleave="task_dragleave(event)" ';
	}
	htmlstr+='>';
//	console.log(htmlstr);
	htmlstr+=new_task_header(item)+'</div>';
	
	return htmlstr;
}
	

function new_task_header2(item){
	var htmlstr='';
//	htmlstr+='<span class="task_header">';
//	htmlstr+='<a class="icon_button expend_fold" id="icon_expend_fold" href="###" onclick="expend_fold('+item.id+')"  title="展开"><i  class="fa fa-folder-o"></i></a>'
	htmlstr+='<a class="expend_fold" href="###" title="展开"><i  class="fa fa-folder-o"></i></a>'
	+'<i  class="fa '+node_type_icon[item.nodetype]+'"></i>'	
	+'<span class="task_title task_for_drag " title="'+String(item.in_date)+'">'+item.title+'</span>';
	
//	htmlstr+='<span class="task_stage"><i  class="fa '+stage_icon[item.stage]+'"></i></span>';//使用font-awesome的字体图标
	htmlstr+='<a class="stage_icon"><i></i></a>';//使用样式表图形文件图标
//	htmlstr+='<img class="stage_icon" src="'+stage_svg_icon[item.stage]+'" >';//使用图标数组

	if(item.start_date){
		htmlstr+='<span class="start_date">&nbsp;'+String(item.start_date).substring(5,10)+'&nbsp;</span>';
	}else{
		htmlstr+='<span class="start_date"></span>';
	}
	if(item.tags){
		htmlstr+='<span class="tags">'+tags_split_html(String(item.tags))+'</span>';
	}else{
		htmlstr=htmlstr+'<span class="tags"></span>';
	}
	if(item.intags){
		htmlstr+='<span class="iconbar">'+style_tags_split_html(String(item.intags))+'</span>';	
	}else{
		htmlstr+='<span class="iconbar"></span>';	
	}
	if(item.internal_link>0){
		htmlstr=htmlstr+'<a class="task_internal_link" href="###" data-internal_link="'+item.internal_link+'" title="关联到其它任务"><i class="fa fa-share-square" onclick="position_task_id('+item.internal_link+')"></i></a>';
	}else{
		htmlstr+='<a class="task_internal_link"></a>';
	}
	
	if(item.link){
		r=item.link.match(/http[s]?\:\/\/([^\/]*)/);
//		console.log(r); 
		if(r){
//			console.log(r[0]);
			htmlstr=htmlstr+'<a class="task_link" href="'+item.link+'" target="_blank" title="外链" ><img  class="fa fa-link" src="'+r[0]+'/favicon.ico'+'" onerror="this.src=\'/_assets/icons/link.svg\';"></a>';
		}else{
			htmlstr=htmlstr+'<a class="task_link" href="'+item.link+'" target="_blank" title="外链"><i class="fa fa-link"></i></a>';			
		}
	}else{
		htmlstr+='<a class="task_link"></a>';
	}
	if(item.photo){
		htmlstr=htmlstr+'<a class="task_photo_icon" href="###" title="图片" data-url="'+item.photo+'"><i class="fa fa-photo"></i></a>';
	}else{
		htmlstr+='<a class="task_photo_icon"></a>';
	}
	if(item.comment){
		htmlstr=htmlstr+'<a class="task_comment_icon" href="###"  title="备注"><i class="fa fa-comment"></i></a>';
	}else{
		htmlstr+='<a class="task_comment_icon"></a>';
		item.comment='';
	}
	
//	htmlstr+='<span class="in_date">&nbsp;'+String(item.in_date).substring(0,10)+'&nbsp;</span>';
	htmlstr+='<a class="magic_icon"><i class="fa"></i></a>';
	htmlstr+='<a class="icon_button btn_for_toolbar"  href="###"  title="操作面板'+item.id+'"><i  class="fa fa-lg fa-angle-double-right"></i></a>';
	htmlstr+='<span class="task_comment radius" ><span><i class="fa fa-check btn" onclick="change_comment(event);"></i><i class="fa fa-remove btn " onclick="close_comment(event);"></i></span><textarea>'+item.comment+'</textarea></span>';

	return htmlstr;
}
	
function new_task_header(item){//用push代替+=，以提高性能
	var buf = [];
	buf.push('<a class="expend_fold" href="###" title="展开"><i  class="fa fa-folder-o"></i></a>'
		+'<i  class="fa '+node_type_icon[item.nodetype]+'"></i>'	
		+'<span class="task_title task_for_drag " title="'+String(item.in_date)+'">'+item.title+'</span>'
	);
	
//	htmlstr+='<span class="task_stage"><i  class="fa '+stage_icon[item.stage]+'"></i></span>';//使用font-awesome的字体图标
	buf.push('<a class="stage_icon"><i></i></a>');//使用样式表图形文件图标
//	htmlstr+='<img class="stage_icon" src="'+stage_svg_icon[item.stage]+'" >';//使用图标数组
//	console.log('<span class="start_date">&nbsp;'+'&nbsp;</span>');
	buf.push('<span class="start_date">' + (item.start_date?String(item.start_date).substring(5,10):'') + '</span>');
	buf.push('<span class="tags">'+(item.tags?tags_split_html(String(item.tags)):'')+'</span>');
	buf.push('<span class="iconbar">'+(item.intags?style_tags_split_html(String(item.intags)):'')+'</span>');
	buf.push((item.internal_link>0)
				?'<a class="task_internal_link" href="###" data-internal_link="'+item.internal_link+'" title="关联到其它任务"><i class="fa fa-share-square" onclick="position_task_id('+item.internal_link+')"></i></a>'
				:'<a class="task_internal_link"></a>'
			);
	
	
	if(item.link){
		r=item.link.match(/http[s]?\:\/\/([^\/]*)/);

		if(r){

			buf.push('<a class="task_link" href="'+item.link+'" target="_blank" title="外链" ><img  class="fa fa-link" src="'+r[0]+'/favicon.ico'+'" onerror="this.src=\'/_assets/icons/link.svg\';"></a>');
		}else{
			buf.push('<a class="task_link" href="'+item.link+'" target="_blank" title="外链"><i class="fa fa-link"></i></a>');			
		}
	}else{
		buf.push('<a class="task_link"></a>');
	}
	if(item.photo){
		buf.push('<a class="task_photo_icon" href="###" title="图片" data-url="'+item.photo+'"><i class="fa fa-photo"></i></a>');
	}else{
		buf.push('<a class="task_photo_icon"></a>');
	}
	if(item.comment){
		buf.push('<a class="task_comment_icon" href="###"  title="备注"><i class="fa fa-comment"></i></a>');
	}else{
		buf.push('<a class="task_comment_icon"></a>');
		item.comment='';
	}
	
	buf.push('<a class="magic_icon"><i class="fa"></i></a>');
	buf.push('<a class="icon_button btn_for_toolbar"  href="###"  title="操作面板'+item.id+'"><i  class="fa fa-lg fa-angle-double-right"></i></a>');
	buf.push('<span class="task_comment radius" ><span><i class="fa fa-check btn" onclick="change_comment(event);"></i><i class="fa fa-remove btn " onclick="close_comment(event);"></i></span><textarea>'+item.comment+'</textarea></span>');
//	console.dir(buf);
	return  buf.join('');
}

function search_by_stage(domid){
	// if(!domid){
		// var domid=$(event.target).parents("div.title_task").attr('id');
	// }
	var stage=$("#"+domid).attr('data-stage');
	$.getJSON("/index.php/task/search_by_stage/"+stage, 
			function(dataGet) { 
				if(dataGet){
					$("#"+domid+" div").remove();
					$.each(dataGet,function(idx,item){ 
//						console.log(item);
						$("#"+domid).append(new_task(item));
					}); 
				}
				$("#"+domid+">a>i.fa-folder-o").addClass('fa-folder-open-o');
				$("#"+domid+">a>i.fa-folder-o").removeClass('fa-folder-o');
			}
		);
	

}


function init_task_refresh(){
		var idArray= new Array();
		var i=0;
//	refresh_child_recursion(idArray);	
	$.post("/index.php/task/getparents_by_tag/", 
			{
				search_words:'默认打开'
			  },
			function(dataGet) { 
				if(dataGet){
					$.each(dataGet,function(idx,item){ 
						idArray[i++]=item;		
					}); 
//					console.log(idArray);
					refresh_child_recursion(idArray);
				}
			}
		,"json");
		
	
}



function show_or_hide_stage(stage){
	switch(stage){
		case 'all':
			$("div.task[data-taskid='1'] div.task").hide();
			$("div.task[data-taskid='2'] div.task").hide();
			$("div.task[data-taskid='2']>div.task").show(500,function(){
				});
			$("#search_view>div.task").show(500,function(){
				});
			$("div.task[data-taskid='1']").show(500,function(){
			});
			break;
		case 'nofinish':
			$("div.task[data-taskid='2']>div.task").show(500,function(){				});
				$("#search_view>div.task").show(500,function(){				});		
			
				$("div.task[data-taskid='2']>div.task[data-stage='finish']").hide(500,function(){				});
				$("#search_view>div.task[data-stage='finish']").hide(500,function(){				});	
			break;
		default:
			$("div.task[data-taskid='2'] div.task:not([data-stage='"+stage+"'])").hide(500,function(){			});	
				$("div.task[data-taskid='2'] div.task[data-stage='"+stage+"']").show(500,function(){			});	
				$("div.task[data-taskid='2'] div.task[data-stage='"+stage+"']").parents("div.task").show(500,function(){			});	
				
				$("#search_view>div.task[data-stage='"+stage+"']").show(500,function(){
			//			$("#btn_show_hide_stage_"+stage).attr("data-action",'hide');
				});	
				$("#search_view>div.task:not([data-stage='"+stage+"'])").hide(500,function(){
			//			$("#btn_show_hide_stage_"+stage).attr("data-action",'hide');
				});	
							
				// $("#alltask_view div.task:not([data-stage='"+stage+"'])").hide(500,function(){			});							
				// $("#alltask_view div.task[data-stage='"+stage+"']").show(500,function(){
					// $("#alltask_view").show(500);
				// });	
				// $("#alltask_view div.task[data-stage='"+stage+"']").parents("div.task").show(500,function(){			});	
				
				$("div.task[data-taskid='1'] div.task:not([data-stage='"+stage+"'])").hide(500,function(){			});							
				$("div.task[data-taskid='1'] div.task[data-stage='"+stage+"']").show(500,function(){
					 $("#alltask_view").show(500);
				});	
				$("div.task[data-taskid='1'] div.task[data-stage='"+stage+"']").parents("div.task").show(500,function(){			});	
	}
	// if(stage=='all'){
	// }else{
		// if(stage=='notfinish'){		
		// }else{
		// }
	// }
}

function show_important_task(){
	$("div.task:not([data-tags~='!'])").hide(500,function(){			});	
	$("div.task:not([data-tags~='!'])").show(500,function(){			});	
	$("div.task:not([data-tags~='!'])").parents("div.task").show(500,function(){			});	
}

function show_or_hide_date(){
	if($("#btn_show_hide_date").attr("data-action")=='show'){
		$(".start_date").show(500,function(){
			$("#btn_show_hide_date").attr("data-action",'hide');
//			$("#btn_show_hide_date").attr("data-action")=='hide';
		});	
	}else{
		$(".start_date").hide(500,function(){
			$("#btn_show_hide_date").attr("data-action",'show');
//			$("#btn_show_hide_date").attr("data-action")=='hide';
		});	
	}
	$("#btn_show_hide_date").toggleClass("btn-primary");
}

function show_or_hide_tags(){
	if($("#btn_show_hide_tags").attr("data-action")=='show'){
		$(".tags").show(500,function(){
			$("#btn_show_hide_tags").attr("data-action",'hide');
//			$("#btn_show_hide_date").attr("data-action")=='hide';
		});	
	}else{
		$(".tags").hide(500,function(){
			$("#btn_show_hide_tags").attr("data-action",'show');
//			$("#btn_show_hide_date").attr("data-action")=='hide';
		});	
	}
	$("#btn_show_hide_tags").toggleClass("btn-primary");
}

function show_or_hide_important(){
	if($("#btn_show_hide_important").attr("data-action")=='show'){
		$('.task[data-tags*="!"]').addClass("important_task");
		$("#btn_show_hide_important").attr("data-action",'hide');
	}else{
		$('.task[data-tags*="!"]').removeClass("important_task");
		$("#btn_show_hide_important").attr("data-action",'show');
	}
	$("#btn_show_hide_important").toggleClass("btn-primary");
}

function view_show_hide(view){
//	console.log($(".container").length);
//	console.log(view);
	if($("#"+view+"_container").attr("data-visible")=='show'){
//		$("#"+view+"_container").css("width",'auto');
		$("#"+view+"_view").hide(500);
		$("#"+view+"_container").attr("data-visible",'hide');	
	}else{
//		$("#"+view+"_container").css("width",'30rem');
		$("#"+view+"_view").show(500);
		$("#"+view+"_container").attr("data-visible",'show');
		switch(view){
			case 'search':
				$("#"+view+"_view input").focus();
				break;
			case 'simple':
				$("#input_simple_task_add").focus();
				break;
			case 'help':
				//		console.dir($('#231 div.task'));
				if(!$('#231 div.task').length){
					create_help_view();
				}
		}		
	}
}
function expend_icon_status(){
	$('div.task a.expend_fold i').css("color",'');
	$('div.task').parents('div.task').children("a.expend_fold").children("i").css("color",'red');
//	$('div.task a.expend_fold i').removeClass("haschild");
//	$('div.task').parents('div.task').children("a.expend_fold").children("i").addClass("haschild");
}

function open_intro(){
layer.open({
    type: 2,
    area: ['700px', '530px'],
    fix: false, //不固定
    maxmin: true,
    content: '/intro.html'
});

}

$(document).ready(function() {


	// var initItems = new Array();
	// initItems[0]={id:1,title:"所有分类任务",sort:100,getway:"R"};
	// initItems[1]={id:2,title:"当前关注不分类任务",sort:100,getway:"R"};
	// initItems[2]={id:1,title:"所有分类任务",sort:100,getway:"R"};
	// initItems[3]={id:1,title:"所有分类任务",sort:100,getway:"R"};
	// initItems[4]={id:1,title:"所有分类任务",sort:100,getway:"R"};
	// initItems[5]={id:1,title:"所有分类任务",sort:100,getway:"R"};
	
//生成3个根任务
	// var item = new Object;
	// item.id = 1;
	// item.title = '所有分类任务';
	// item.sort=100;
	// item.getway="R";
	// create_one_task(item,"#alltask_view");
	
	// var item = new Object;
	// item.id = 2;
	// item.title = '当前关注不分类任务';
	// item.sort=100;
	// item.getway="R";
	// create_one_task(item,"#simple_view");
	
	// var item = new Object;
	// item.id = 3;
	// item.title = '归档不分类任务';
	// item.getway="R";
	// item.sort=100;
//	create_one_task(item,"#simple_view");
    
    //一键取得所有活动任务并挂装
	refresh_all_and_append();
	
/* 	$("#stage_view div").remove();
		
	var item = new Object;
	item.id = 160;
	item.title = '迫切';
	item.stage='urgent';
	item.getway="T";
	create_title_task(item,"#stage_view");
	var item = new Object;
	item.id = 143;
	item.title = '活动';
	item.stage='doing';
	item.getway="T";
	create_title_task(item,"#stage_view");
	var item = new Object;
	item.id = 177;
	item.title = '协作';
	item.stage='farm-out';
	item.getway="T";
	create_title_task(item,"#stage_view");
	var item = new Object;
	item.id = 139;
	item.title = '思路';
	item.stage='think';
	item.getway="T";
	create_title_task(item,"#stage_view");	
	var item = new Object;
	item.id = 205;
	item.title = '挂起';
	item.stage='suspend';
	item.getway="T";
	create_title_task(item,"#stage_view");
	var item = new Object;
	item.id = 138;
	item.title = '完成';
	item.stage='finish';
	item.getway="T";
	create_title_task(item,"#stage_view");


	var domid=$("#stage_view>div.task.title_task[data-stage='urgent']").attr('id');
	search_by_stage(domid);
	domid=$("#stage_view>div.task.title_task[data-stage='doing']").attr('id');
	search_by_stage(domid); */
	
//创建帮助视图		
/* 	var item = new Object;
	item.id = 231;
	item.title = '如何使用任务清单';
	item.sort=100;
	item.getway="R";
	create_one_task(item,"#help_view"); */

	// var idArray= new Array(231,211,216,221,1523,1524,1935);
	// refresh_child_recursion(idArray,1);	
	
//	create_help_view();
	
	
//查询“默认展开”的任务，并创建挂装
//	init_task_refresh();
//	expend_all_actived_task();
//展开,依据jquery选择器	
//	expend_fold_by_jquery_dom('#alltask_view div.task[data-taskid=137]');



	$("#input_simple_task_add").focus();
	
	$("body").delegate('.twink','click',function(e){
		event = e||event; //为兼容firefox的事件模型
			$(event.target).removeClass("twink");
	});
	
	$("body").delegate('#simple_view .task_title,#alltask_view .task_title','click',function(e){
			event = e||event; //为兼容firefox的事件模型
//			console.log($(event.target));

			if($(event.target).parent(".task").hasClass('selected')){
				$(".selected").removeClass('selected');
				select_dom_id = null;
				select_task_id = null;
			}else{
				$(".selected").removeClass('selected');
				$(event.target).parent(".task").addClass('selected');
				select_dom_id = $(event.target).parent(".task").attr('id');
				select_task_id = $(event.target).parent(".task").attr('data-taskid');
//				console.log(select_dom_id);
//				console.log(select_task_id);
			}
			
	});
	
	
	
/* 	$("body").delegate('#simple_view .task_title,#alltask_view .task','click',function(){
			console.log($(event.target));
			if($(event.target).parent(".task").hasClass('selected')){
				$(".selected").removeClass('selected');
				select_dom_id = null;
				select_task_id = null;
			}else{
				$(".selected").removeClass('selected');
				$(event.target).parent(".task").addClass('selected');
				select_dom_id=$(event.target).parent(".task").attr('id');
				select_task_id = $(event.target).parent(".task").attr('data-taskid');
				console.log(select_dom_id);
				console.log(select_task_id);
			}
			
	}); */
	
	
	$("body").delegate('a.expend_fold','click',function(e){
			event = e||event; //为兼容firefox的事件模型
//			console.log(event.target);
			var domid=$(event.target).parents("div.task").first().attr("id");
//			console.log(domid);
			expend_fold_by_domid(domid);
	});
		

	$("body").delegate('a.task_comment_icon','click',function(e){
		event = e||event; //为兼容firefox的事件模型
			show_task_comment();
	});
	$("body").delegate('a.task_photo_icon','click',function(e){
		event = e||event; //为兼容firefox的事件模型
//			console.log($(event.target).parent("a.task_photo_icon").attr('data-url'));
			$("#task_photo_show img").attr("src",$(event.target).parent("a.task_photo_icon").attr('data-url'));
			$("#task_photo_show").css("left",(event.pageX+100)+'px').css("top",(event.pageY+10)+'px').toggle(200);  
//			$("#task_photo_show").css("top",(event.pageY+10)+'px'); 
//			$("#task_photo_show").toggle(200);
//			console.log(event.target);
			
	});	

	 
});	//end of $(document).ready事件

 </script>
</head>
<body>
<div  class="page_header cl" style="width:100%;height:80px;">
<?php echo $loginbar; ?>
<div><div class="logo"><a href="/">&nbsp;<img src="/_assets/img/logo_50_80.png" style="vertical-align:bottom">&nbsp;&nbsp;<span style="color:blue;">think</span><span style="color:red;">todo.cn</span></a></div><h3>想即做 任务清单</h3></div>

<div id="btn-bar" class="cl r " style="position:absolute;z-index:101;right:5px;">
	<button class="btn btn-info radius r" href="javascript:void(0);" title="快速上手！" onclick="javascript:introJs().setOptions({'prevLabel':'&larr; 上一步','nextLabel':'下一步 &rarr;','skipLabel':'跳过','doneLabel':'完成'}).start();;"><img src=/_assets/icons/roadsign.png style="width:24px;height:18px;"></button>
	<div class="btn-group r" >
		<div class="btn-group" style="display:none;" role="group" aria-label="..." >
			<button class="btn radius r" id="btn_show_hide_important" role="button" href="###" onclick="show_or_hide_important();" data-action="show" title="突出重要任务" ><i class="fa fa-exclamation fa-fw"></i></button>
			<button class="btn btn-primary radius r" id="btn_show_hide_date" role="button" href="###" onclick="show_or_hide_date();" data-action="hide" title="显示/隐藏日期" ><i class="fa fa-calendar fa-fw"></i></button>
			<button class="btn btn-primary radius r" id="btn_show_hide_tags" role="button" href="###" onclick="show_or_hide_tags();" data-action="hide" title="显示/隐藏标签" ><i class="fa fa-tags fa-fw"> </i></button>		
		</div>
		<button class="btn btn-warning radius r" role="button" href="###" onclick='$(this).siblings(".btn-group").toggle();' title="设置" ><i class="fa fa-gear fa-fw"> </i></button>
	</div>

	<button class="btn btn-success radius r" id="btn_refresh_all" role="button" href="###" onclick="refresh_all_and_append1();" data-action="hide" title="一键刷新" ><i class="fa fa-refresh fa-fw"> </i></button>

	<div class="btn-group r " >
	  <button type="button" class="btn btn-warning" title="查看不同状态的任务">筛选</button>
	  <button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		<span class="caret"></span>
	  </button>
	  <ul class="dropdown-menu" style="right:0;min-width:100px;">
		<li><a href="#" onclick="show_or_hide_stage('all');">全部</a></li>
		<li role="separator" class="divider"></li>	
		<li><a href="#" onclick="show_or_hide_stage('urgent');"><i class="fa fa-fw fa-bomb icon-urgent "></i>迫切</a></li>
		<li><a href="#" onclick="show_or_hide_stage('doing');"><i class="fa fa-fw fa-play-circle icon-doing "></i>在办</a></li>
		<li><a href="#" onclick="show_or_hide_stage('suspend');"><i class="fa fa-fw fa-pause icon-pause "></i>暂停</a></li>
		<li><a href="#" onclick="show_or_hide_stage('farm-out');"><i class="fa fa-fw fa-puzzle-piece icon-hand "></i>委托</a></li>
		<li><a href="#" onclick="show_or_hide_stage('think');"><i class="fa fa-fw fa-lightbulb-o icon-think "></i>思考</a></li>
		<li><a href="#" onclick="show_or_hide_stage('question');"><i class="fa fa-fw fa-question icon-question "></i>疑问</a></li>	
		<li><a href="#" onclick="show_or_hide_stage('finish');"><i class="fa fa-fw fa-check icon-finish "></i>完成</a></li>
		<li><a href="#" onclick="show_or_hide_stage('send');"><i class="fa fa-fw fa-paper-plane icon-send "></i>交差</a></li>
		<li><a href="#" onclick="show_or_hide_stage('');"><i class="fa fa-fw fa-circle-thin "></i>无状态</a></li>
		
		
<!--
		<li role="separator" class="divider"></li>	
		<li><a href="#" onclick="show_or_hide_stage('notfinish');"><i class="fa fa-fw icon-nofinish "></i>未完成</a></li>
		<li role="separator" class="divider"></li>	
		<li><a href="#" onclick="show_important_task();"><i class="fa fa-fw icon-nofinish "></i>重要</a></li>
-->
		</ul>
	</div>
	
</div>

</div>


<div id="simple_container" class="view_container" data-visible="show" data-step="1" data-intro="快捷新增任务!"  data-position='right'>
<header><i class="fa fa-plus fa-2x fa-fw" onclick="view_show_hide('simple');" title="快捷增加任务"></i></header>
<div id="simple_view" class="view" class="view_content">
<div id="simple_task_add_area" class="cl  text-right" style="height:34px; margin:5px;" data-step="2" data-intro="快速新增任务!"  data-position='bottom'>
<!--
用了bootstrap后，是否不用再写回车代码了，不然会提交两次
<form class="form-inline">
<input id="input_simple_task_add" class="form-control radius  "   type=text>
<button  class="btn btn-primary "  onclick="simple_task_add()">新增</button>
<button class="btn "  onclick="javascript:$('#input_simple_task_add').val('');">清除</button>
</form>
-->
<div class="form-inline form-horizontal">
<input id="input_simple_task_add" class="form-control radius  col-xs-8"  onkeydown='if(event.keyCode==13){simple_task_add();}'  type=text>
<button  class="btn btn-primary col-xs-2"  onclick="simple_task_add()">新增</button>
<button class="btn col-xs-2"  onclick="javascript:$('#input_simple_task_add').val('');">清除</button>
</div>

</div>
	<div data-taskid="2" class="task getby_parent" id="902"  data-getway="R" 
		ondragover="task_dragover(event)" ondrop="task_drop(event)" ondragenter="task_dragenter(event)" ondragleave="task_dragleave(event)">
		<a class="expend_fold" href="###" title="展开"><i class="fa fa-folder-o"></i></a>
		<span class="task_title task_for_drag ">当前不分类任务</span>
		<a class="icon_button btn_for_toolbar" href="###" title="操作面板2"><i class="fa fa-lg fa-angle-double-right"></i></a>
	</div>
	<div data-taskid="3" class="task getby_parent" id="903"  data-getway="R" 
		ondragover="task_dragover(event)" ondrop="task_drop(event)" ondragenter="task_dragenter(event)" ondragleave="task_dragleave(event)">
		<a class="expend_fold" href="###" title="展开"><i class="fa fa-folder-o"></i></a>
		<span class="task_title task_for_drag ">不再关注任务</span>
		<a class="icon_button btn_for_toolbar" href="###" title="操作面板3"><i class="fa fa-lg fa-angle-double-right"></i></a>
	</div>
	<div data-taskid="4" class="task getby_parent" id="904"  data-getway="R" 
		ondragover="task_dragover(event)" ondrop="task_drop(event)" ondragenter="task_dragenter(event)" ondragleave="task_dragleave(event)">
		<a class="expend_fold" href="###" title="展开"><i class="fa fa-folder-o"></i></a>
		<span class="task_title task_for_drag ">任务挂装区</span>
		<a class="icon_button btn_for_toolbar" href="###" title="操作面板4"><i class="fa fa-lg fa-angle-double-right"></i></a>
	</div>
</div>


<!--
<div id="#current_task"></div>
<div id="#save_task"></div>
-->
</div>
<div id="alltask_container" class="view_container" data-visible="hide" data-step="3" data-intro="对任务进行分类组织!"  data-position='bottom' ><header><i class="fa fa-sitemap fa-rotate-270 fa-2x fa-fw" onclick="view_show_hide('alltask');" title="分类任务"></i></header>
<div id="alltask_view"  class="view_content">
	<div data-taskid="1" class="task getby_parent" id="901"  data-getway="R" 
		ondragover="task_dragover(event)" ondrop="task_drop(event)" ondragenter="task_dragenter(event)" ondragleave="task_dragleave(event)">
		<a class="expend_fold" href="###" title="展开"><i class="fa fa-folder-o"></i></a>
		<span class="task_title task_for_drag ">所有分类任务</span>
		<a class="icon_button btn_for_toolbar" href="###" title="操作面板1"><i class="fa fa-lg fa-angle-double-right"></i></a>
        <span class="task_comment radius"><span><i class="fa fa-check btn" onclick="change_comment(event);"></i>
        <i class="fa fa-remove btn " onclick="close_comment(event);"></i></span><textarea></textarea></span>
	</div>
</div>
</div>
<div id="calendar_container" class="view_container" data-visible="hide" data-step="4" data-intro="查看任务的日程表!"  data-position='bottom'><header><i class="fa fa-calendar fa-2x fa-fw" onclick="view_show_hide('calendar');" title="日历视图"></i></header><div id='calendar_view' ></div>
</div>
<!--
<div id="stage_container" class="view_container"data-visible="hide" data-step="4" data-intro="按状态查看任务!"  data-position='bottom'><header><i class="fa fa-bomb fa-2x fa-fw" onclick="view_show_hide('stage');" title="按任务状态"></i></header><div id="stage_view" class="view_content"></div></div>
-->
<div id="search_container" class="view_container" data-visible="hide" data-step="5" data-intro="搜索所有的任务!"  data-position='bottom'>
	<header><i class="fa fa-search fa-2x fa-fw" onclick="view_show_hide('search');" title="搜索"></i></header>
<div id="search_view" class="view_content">

<div id="task_search_area" class="cl" >
<!--
<form class="form-inline">
用了bootstrap后，是否不用再写回车代码了，不然会提交两次
提交时偶尔会刷新页面
<input id="input_task_search" class="form-control radius "  type=text>
-->
<div class="form-inline">
<input id="input_task_search" class="form-control radius "  onkeydown='if(event.keyCode==13){task_search();}' type=text>
<button class="btn btn-primary " onclick="task_search()">搜索</button>
<button class="btn "  onclick="clear_search()">清除</button>
<button class="btn "  onclick="save_search_words()">保存</button>
</div>
<!--
</form>
-->
</div>
<div id="saved_search_words_area">
<i id="btn_saved_search_words_area" class="fa fa-2x fa-star " onclick="show_save_search()" style="float:right;margin:3px;" title="保存的搜索"></i>
<div id="saved_search_words" style="display:none;">
</div>
</div>
</div>
</div>

<div id="help_container" class="view_container" data-visible="hide" data-step="6" data-intro="更多操作帮助在这里!"  data-position='bottom'><header><i class="fa fa-question fa-2x fa-fw" onclick="view_show_hide('help');" title="帮助"></i></header>
<div id="help_view" class="view_content">
	<div data-taskid="231" class="task getby_parent" id="231"  data-getway="R" >
		<a class="expend_fold" href="###" title="展开"><i class="fa fa-folder-o"></i></a>
		<span class="task_title task_for_drag ">如何使用thinktodo任务清单</span>
		<a class="icon_button btn_for_toolbar" href="###" title="操作面板231"><i class="fa fa-lg fa-angle-double-right"></i></a>
	</div>
</div></div>


<div id="task_toolbar" class="radius " style="display:none;">
<i class="fa fa-fw fa-remove btn  for_task for_search for_root for_title" style="float:right;" onclick="hide_toolbar()" title="关闭"></i>

<i class="fa fa-fw fa-refresh btn radius btn-default for_task for_root for_title" onclick="refresh_dom_child()" title="刷新" ></i>
<i class="fa fa-fw fa-sort-up btn btn-default radius for_task" onclick="upDown('up')" title="上移"></i>
<i class="fa fa-fw fa-sort-down  btn radius btn-default for_task" onclick="upDown('down')" title="下移"></i>
<i class="fa fa-fw fa-crosshairs btn radius btn-default for_search" onclick="position_task_id()" title="定位"></i>
<i class="fa fa-fw fa-eye-slash  btn radius btn-default for_simple_view_2" onclick="task_archive_to(3)" title="不关注"></i>
<i class="fa fa-fw fa-eye  btn radius btn-default for_simple_view_3" onclick="task_archive_to(2)" title="恢复关注"></i>
<i class="fa fa-fw fa-archive  btn radius btn-default for_task" onclick="task_archive()" title="归档/恢复"></i>
<i class="fa fa-fw fa-bullhorn  btn radius btn-default for_task" onclick="pub()" title="发布"></i>
<i class="fa fa-fw fa-trash btn radius btn-default for_task" onclick="del_myself()" title="删除任务"  ></i>
<br>
<i class="fa fa-fw fa-plus btn radius btn-default for_task for_root" onclick="call_add_child_input()" title="增加子任务"  ></i>
<i class="fa fa-fw fa-edit btn radius btn-default for_task" onclick="task_text_edit('title')" title="修改任务" ></i>
<i class="fa fa-fw fa-tags btn radius btn-default for_task" onclick="task_text_edit('tags')" title="标签" ></i>
<i class="fa fa-fw fa-gears btn radius btn-default for_task" onclick="task_text_edit('intags')" title="样式标签" ></i>
<i class="fa fa-fw fa-link btn radius btn-default for_task" onclick="task_text_edit('link')" title="链接" ></i>
<i class="fa fa-fw fa-share-square btn radius btn-default for_task" onclick="task_text_edit('internal_link')" title="内链" ></i>
<!--
<i class="fa fa-fw fa-anchor btn radius btn-default for_task" id="btn_anchor" onclick="set_anchor()" title="锚记" ></i>
-->
<i class="fa fa-fw fa-comment btn radius btn-default for_task " onclick="show_task_comment()" title="备注" ></i>
<i class="fa fa-fw fa-photo btn radius btn-default for_task " onclick="task_text_edit('photo')" title="图片" ></i>
<br>
<!--

<div id="text_edit_div" style="display:none;" data-action="title">
<input id="input_text_edit" class="input-text radius" type=text onkeydown='if(event.keyCode==13){edit_task_text_ok();}' value="">
<a class="btn btn-default" herf="###" onclick="edit_task_text_ok();"><i class="fa fa-check-circle-o"></i></a>
<a class="btn btn-default" herf="###" onclick="edit_task_text_cancel();"><i class="fa fa-times-circle-o"></i></a>
</div>


-->
<div class="form-inline" id="text_edit_div" style="display:none;" data-action="title">
<!--
用了bootstrap后，是否不用再写回车代码了，不然会提交两次
<input id="input_simple_task_add" class="form-control radius  "  onkeydown='if(event.keyCode==13){simple_task_add();}'  type=text>
-->
<input id="input_text_edit" class="form-control radius" type=text onkeydown='if(event.keyCode==13){edit_task_text_ok();}' value="">

<button  class="btn btn-primary "  onclick="edit_task_text_ok();"><i class="fa fa-check-circle-o"></i></button>
<button class="btn "  onclick="edit_task_text_cancel();"><i class="fa fa-times-circle-o"></i></button>
</div>


<i class="fa fa-fw fa-square icon-blank btn radius btn-default for_task for_search" title="无状态" onclick="change_stage('')"> </i>
<i class="fa fa-fw fa-question icon-question btn radius btn-default  for_task for_search" title="疑问" onclick="change_stage('question')"> </i>
<i class="fa fa-fw fa-lightbulb-o icon-think btn radius btn-default  for_task for_search" title="思路" onclick="change_stage('think')"> </i>
<i class="fa fa-fw fa-play-circle icon-doing btn radius btn-default for_task for_search " title="活动" onclick="change_stage('doing')"> </i>
<i class="fa fa-fw fa-bomb icon-urgent btn radius btn-default  for_task for_search" title="迫切" onclick="change_stage('urgent')"> </i>
<i class="fa fa-fw fa-puzzle-piece icon-hand btn radius btn-default for_task for_search" title="协作" onclick="change_stage('farm-out')"> </i>
<i class="fa fa-fw fa-pause icon-pause btn radius btn-default for_task for_search" title="挂起" onclick="change_stage('suspend')"> </i>
<i class="fa fa-fw fa-paper-plane icon-send btn radius btn-default for_task for_search" title="交差" onclick="change_stage('send')"> </i>
<i class="fa fa-fw fa-check icon-finish btn radius btn-default for_task for_search" title="完成" onclick="change_stage('finish')"> </i>
<i class="fa fa-fw fa-remove icon-giveup btn radius btn-default for_task for_search" title="放弃" onclick="change_stage('giveup')"> </i>


</div>
<div id="task_photo_show" class="radius " style="display:none;position:absolute;z-index:5;"><img></div>

<footer>
<div class="footer">
    <ul style="float:right;">
    <li><a href="###" onclick="open_intro();">我们这样理解任务</a></li>
    <li><a href=/index.php/article/get/962 target="_blank">更新日志</a></li>
        <li>(请使用chrome或IE10以上浏览器)</li>
	<li><a href="/cate/" target="_blank">分类模式（测试）</a></li>
	<li><a href="/index.php/home/w/1" target="_blank">多工作区模式（测试）</a></li>    	
    <li><a href="http://test.thinktodo.cn" target="_blank">测试版本</a></li>  
    </ul>
</div>
</footer>
<div id="temp" style="display:none;"></div>
<script src="/libs/mousetrap.min.js"></script>	
<script type="text/javascript" src="/libs/jquery.scrollTo-2.1.2/jquery.scrollTo.js"></script>       
<script src="/_assets/js/app/for_save_search.js"></script>	
<script src="/_assets/js/app/keep_alive.js"></script>
<script src="/_assets/js/app/task_search.js"></script>
<script src="/_assets/js/app/mycalendar.js"></script> 
<script src="/_assets/js/app/mycalendar_drag.js"></script> 
<script src="/_assets/js/app/expend_fold.js"></script> 
<script src="/_assets/js/app/toolbar.js"></script>
<script src="/_assets/js/app/task_drag2.js"></script>      
<script src="/_assets/js/app/keyboard.js"></script> 
<script type="text/javascript" src="/libs/introjs/intro.js"></script>
<script type="text/javascript" src="/libs/moment.min.js"></script>
</body>
</html>